<?php
/**
 * Created by PhpStorm.
 * User: geolo
 * Date: 2018/11/21
 * Time: 15:14
 */
namespace app\modules\mch\models;
use app\models\Super;

/**
 * Class SuperForm
 * @property Super $model
 */
class SuperForm extends Model
{
    public $store_id;
    public $money;
    public $model;
    public $type;

    public function rules(){
        return[
            [['store_id','type'], 'integer'],
            [['store_id','money'],'required'],

        ];
    }
    public function attributeLabels()
    {
        return[
            ['store_id'=>'商城id'],
            ['money'=>'金额'],
            ['type'=>'type'],
        ];
    }
    public function save(){

        if (!$this->validate()) {
            return $this->getModelError();
        }
        $this->model->money = $this->money;
        $this->model->type = $this->type;
        if ($this->model->isNewRecord) {
            $this->model->store_id = $this->store_id;
        }
        if ($this->model->save())
            return [
                'code' => 0,
                'msg' => '保存成功',
            ];
        else
            return $this->getModelError($this->model);
    }

}